package com.nbufe.controller;

import com.nbufe.domain.ResponseResult;
import com.nbufe.domain.dto.target.AddTargetDto;
import com.nbufe.domain.dto.target.EditTargetDto;
import com.nbufe.domain.dto.target.QueryEmissionTargetDto;
import com.nbufe.domain.dto.target.QueryTargetPageDto;
import com.nbufe.domain.entity.CarbonTarget;
import com.nbufe.domain.vo.news.News;
import com.nbufe.service.CarbonTargetService;
import com.nbufe.service.NewsService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 碳目标接口Api
 * @Author luzhiheng
 * @Date 2023/12/24 17:42
 */
@RestController
@RequestMapping("/carbon_target")
public class CarbonTargetController {

    @Resource
    private CarbonTargetService carbonTargetService;

    @PostMapping("/addTarget")
    public ResponseResult addTarget(@RequestBody AddTargetDto dto) {
        carbonTargetService.addTarget(dto);
        return ResponseResult.okResult();
    }

    @PostMapping("/pageList")
    public ResponseResult queryTargetPage(@RequestBody QueryTargetPageDto dto) {
        return carbonTargetService.queryTargetPage(dto);
    }

    @PostMapping("/list")
    public ResponseResult queryAllTarget() {
        return carbonTargetService.queryAllTarget();
    }

    @PostMapping("/listByDate/{flag}")
    public ResponseResult listByDate(@PathVariable Integer flag) {
        return carbonTargetService.queryAllTargetByDate(flag);
    }

    @PostMapping("/queryTwoHighTarget")
    public ResponseResult queryTwoHighTarget() {
        return carbonTargetService.queryTwoHighTarget();
    }

    @PostMapping("/enableTarget/{id}")
    public ResponseResult enableTarget(@PathVariable Long id) {
        return carbonTargetService.enableTarget(id);
    }

    @PostMapping("/unEnableTarget/{id}")
    public ResponseResult unEnableTarget(@PathVariable Long id) {
        return carbonTargetService.unEnableTarget(id);
    }

    @PostMapping("/editTarget")
    public ResponseResult editTarget(@RequestBody EditTargetDto dto) {
        carbonTargetService.editTarget(dto);
        return ResponseResult.okResult();
    }

    @PostMapping("/queryStageProcessYearMonthEmission")
    public ResponseResult queryStageProcessYearMonthEmission(@RequestBody QueryEmissionTargetDto dto) {
        return carbonTargetService.queryStageProcessYearMonthEmission(dto);
    }

    @PostMapping("/queryWarningDetail/{id}")
    public ResponseResult queryStageProcessYearMonthEmission(@PathVariable Long id) {
        return carbonTargetService.queryWarningDetail(id);
    }
}